/**
 *Project: jh-framework
 *File: cn.xkshow.framework.spider.model.Sina.java 
 *Author: admin@xkshow.cn with the copyrite
 ****************************************************************
 *   VERSION       DATE            BY       CHANGE/COMMENT
 * --------------------------------------------------------------
 *    1.0        2013-4-23        xkshow.cn         create
 ****************************************************************
 *note:
 ***************************************************************/ 
package cn.xkshow.commons.spider.model;

import java.util.Date;

import cn.xkshow.commons.spider.baseIface.HtmlCode;
import cn.xkshow.commons.spider.Universal;
import cn.xkshow.util.regex.WebTags;


public class Sina extends HtmlCode implements Universal{
	private String Title; //新闻标题
	private Date date; //新闻时间
	private String source; //新闻来源
	private String content;//新闻内容
	private String html; //新闻源文件
	
	public Sina(String url, String code) {
		super(url, code);
		this.setHtml(this.getHtmlStr());
	}
	 
	public String getTitle() {
		
		return Title;
	}
	public void setTitle(String title) {
		String str = this.getPattern("<h1 id=\"artibodyTitle\".*?</h1>", this.getHtml());
		Title = WebTags.clearHTML(str);
	}
	public Date getDate() {
		return date;
	}
	public void setDate(String date) {
		
		this.date = new Date();
	}
	public String getSource() {
		//System.out.println("HRoot");
		return source;
	}
	public void setSource(String source) {
		String ly = this.getPattern("<span id=\"media_name\">.*?</span>", this.getHtml());
		this.source = WebTags.clearHTML(ly);
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		String str = this.getPattern("<div class=\"blkContainerSblkCon\" id=\"artibody\">.*?</div>", this.getHtml());
		str = str.split("<style>")[0];
		this.content = WebTags.clearHTML(str.replace("<p>", "{p}")).replace("{p}", "<br/>");
	}
	public String getHtml() {
		return html;
	}
	public void setHtml(String html) {
		//在这里根据url获取到网址的源代码
		//System.out.println(html);
		this.html = html;
	}
	
}
